
#ifndef   __SIMPHONY_KEYPAD
#define   __SIMPHONY_KEYPAD

/* state of the keys */
typedef union 
{
		unsigned long Keys;
		struct
		{
				unsigned 	ZERO 		  	: 	1;
				unsigned 	ONE 		  	: 	1;	    	
				unsigned 	TWO 		  	: 	1;
				unsigned 	THREE 	  	: 	1;
				unsigned 	FOUR 		  	: 	1;
				unsigned 	FIVE 		  	: 	1;
				unsigned		SIX 		  	: 	1;
				unsigned 	SEVEN 	  	: 	1; 
				unsigned 	EIGHT 	  	: 	1;
				unsigned 	NINE 		  	: 	1;	    	
				unsigned 	STAR		  	: 	1;
				unsigned 	POUND		  	: 	1;	/* '#' key */
				unsigned 	K_OFF		  	: 	1;
				unsigned 	MENU 		  	: 	1;
				unsigned 	CLEAR 	  	: 	1;
				unsigned		OKAY		  	: 	1;
				unsigned 	sHOOK		  	:	1;
				unsigned 	sON_OFF	  	:	1;
				unsigned 	SIM_INT		:	1;
				unsigned		SIM_EXT		:	1;
				
		}Key;

}KEYPAD;

enum
{
	KEY_ZERO = 2,	
	KEY_ONE, 	
	KEY_TWO, 	
	KEY_THREE, 
	KEY_FOUR, 	
	KEY_FIVE, 	
	KEY_SIX, 	
	KEY_SEVEN, 
	KEY_EIGHT, 
	KEY_NINE, 	
	KEY_STAR,	
	KEY_POUND,	
	KEY_OFF
};

#define	KEY_MENU 		'M'				  
#define	KEY_CLEAR 		'C'				  
#define	KEY_OKAY			'O'			  
#define	KEY_ON_OFF		'F'	  					  


enum
{
	HOOK_ON = 2,					  /*  */
	HOOK_OFF,
	SIM_EXTERNAL_IN,
	SIM_EXTERNAL_OUT,
	SIM_INTERNAL_IN,
	SIM_INTERNAL_OUT
};



#define   KEY						Keypad.Key
#define   HOOK_STATE				KEY.sHOOK		 
#define	 ON_OFF_STATE			KEY.sON_OFF
#define   SIM_SWITCH_STATE		KEY.sSIM_SWITCH 

/* /\* HOOK state: OFF -> |, ON -> -   *\/ */
/* #define   HOOK_OFF	HIGH */
/* #define   HOOK_ON		LOW			 */
/* /\* SIM switch state  *\/ */
/* #define   SIM_EXTERNAL		LOW */
/* #define   SIM_INTERNAL		HIGH */

extern KEYPAD near Keypad;			  /* State of keys */
extern unsigned char near PressedKey;		  /* Name of key which was pressed  */
extern unsigned char near InputsState;			  /* events of HOOKSET and SIM_SWITCH */
extern unsigned char OnKeyDeb_val;

void Drive_Keypad ( void );
void Keypad_Init ( void );
void Ext_SIM_Unblock( void );
void Ext_SIM_Block( void );

#endif

